package swing.chapter04;

import swing.util.SwingConsle;

import javax.swing.*;

/**
 * 表格
 */
public class JTable1 extends JFrame {

    public JTable1() {
        String[] columnNames = {"编号", "姓名", "年龄"};
        String[][] rowData = {
                {"1","张三","18"},
                {"2","张三2","58"},
                {"3","张三3","38"},
                {"4","张三4","8"},
                {"5","张三5","28"},
                {"6","李四","28"},
                {"7","王五","28"},
                {"8","张三5","28"},
                {"9","赵六","28"},
        };

        JTable jTable = new JTable(rowData, columnNames);

        add(new JScrollPane(jTable));
    }

    public static void main(String[] args) {
        SwingConsle.run(new JTable1(), 300, 200);
    }
}
